﻿<!--
Copyright © 2010 François Karman

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

See <license.txt> for the complete license of the software.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:l="clr-namespace:Faz.Dependencies"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib">

    <!--
      The styles used for the dependency table
    -->

    <!-- The thickness used for all the cells of the dependency table -->
    <Thickness x:Key="DependencyThickness">0,0,1,1</Thickness>

    <!-- The corner of the table -->
    <Border x:Key="DependencyViewCorner"
            BorderThickness="{StaticResource DependencyThickness}"
            BorderBrush="{l:ApplicationResource BrushBorder}"
            SnapsToDevicePixels="True" />

    <!-- The template used for the result elements -->
    <DataTemplate x:Key="TemplateDependencyResultBoolean"
                  DataType="{x:Type sys:Boolean}">
        <Image x:Name="control"
               VerticalAlignment="Center"
               HorizontalAlignment="Center">
        </Image>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding}"
                         Value="True">
                <Setter TargetName="control"
                        Property="Source"
                        Value="{l:ApplicationResource ImageDependencyResult}" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <!-- The template used for the line elements -->
    <DataTemplate x:Key="TemplateDependencyHeader"
                  DataType="{x:Type l:AssemblyOverview}">
        <TextBlock VerticalAlignment="Center"
                   HorizontalAlignment="Right"
                   Margin="4,0,4,0">
            <TextBlock Text="{Binding Path=Name}" />
            <TextBlock Text="-" />
            <TextBlock Text="{Binding Path=Level}" />
        </TextBlock>
    </DataTemplate>

    <!-- The template used for the column elements -->
    <DataTemplate x:Key="TemplateDependencyReference"
                  DataType="{x:Type l:AssemblyOverview}">
        <TextBlock Text="{Binding Path=Name}"
                   HorizontalAlignment="Center"
                   SnapsToDevicePixels="True"
                   Margin="0,4,0,4">
            <TextBlock.LayoutTransform>
                <RotateTransform Angle="270" />
            </TextBlock.LayoutTransform>
        </TextBlock>
    </DataTemplate>

    <!-- The style used for all the cells of the dependency table -->
    <Style x:Key="StyleDependencyListItem"
           TargetType="{x:Type ListViewItem}"
           BasedOn="{l:ApplicationResource StyleDefaultListItem}">
        <Setter Property="BorderThickness"
                Value="{StaticResource DependencyThickness}" />
        <Setter Property="MinHeight"
                Value="18" />
        <Setter Property="MinWidth"
                Value="18" />
    </Style>

    <!-- The style of the line header cells -->
    <Style x:Key="StyleDependencyHeaderListItem"
           TargetType="{x:Type ListViewItem}"
           BasedOn="{l:ApplicationResource StyleDependencyListItem}">
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=Category}"
                               Value="{x:Static Member=l:Category.InitialAssembly}" />
                    <Condition Binding="{Binding Path=IsFocused, RelativeSource={x:Static RelativeSource.Self}}"
                               Value="False" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Background"
                        Value="LightGreen" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=Category}"
                               Value="{x:Static Member=l:Category.IndirectAssembly}" />
                    <Condition Binding="{Binding Path=IsFocused, RelativeSource={x:Static RelativeSource.Self}}"
                               Value="False" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Background"
                        Value="LightYellow" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>

    <!-- The style of the column header cells -->
    <Style x:Key="StyleDependencyReferenceListItem"
           TargetType="{x:Type ListViewItem}"
           BasedOn="{l:ApplicationResource StyleDependencyHeaderListItem}">
        <Setter Property="VerticalContentAlignment"
                Value="Bottom" />
    </Style>

    <!-- The style of the result header cells -->
    <Style x:Key="StyleDependencyResultListItem"
           TargetType="{x:Type ListViewItem}"
           BasedOn="{l:ApplicationResource StyleDependencyListItem}">
        <Setter Property="BorderBrush"
                Value="LightGray" />
    </Style>

</ResourceDictionary>